import React from 'react';
import { connect } from 'dva';
import { getStatus } from '@/utils/business';
import styles from './index.less';
// 项目审批列表：用approveResult    type=1
// 项目库列表：用project.approveStatus   type=2
// 项目申报列表：用project.approveStatus   type=2
// 详情页：用list接口里的result             type=3

const Index = ({ data = {}, type }: any) => {
  const status = getStatus(data, type);
  return (
    <div>
      {status === 1 ? (
        <div className={styles.success}>已通过</div>
      ) : status === 2 ? (
        <div className={styles.error}>未通过</div>
      ) : status === 3 ? (
        <div className={styles.pending}>审核中</div>
      ) : (
        <div className={styles.pending}>待审批</div>
      )}
    </div>
  );
};
export default connect(state => state['base'])(Index);
